<?php

class Permission extends CI_Model {
	
	function __construct()
	{
		parent::__construct();
	}

	function getRole($userName)
	{
		#$user['role'] = $this ->db ->get_where('permission',array('userName' => $userName));
		# need to be optimized
		$roles = $this ->db ->get_where('permission',array('userName' => $userName));
		if ($roles->result() == null) {
			return "applicant";
		}else {
			foreach ($roles->result() as $row) {
				return $row->role;
			}
		}
	}
}

?>
